package com.fulihui.wgj.dal.mybatis.repository;

import com.fulihui.wgj.dal.mybatis.domain.WxSubUserDetail;
import com.fulihui.wgj.dal.mybatis.mapper.WxSubUserDetailMapper;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * @author wang_wx
 * @date 2018-06-20
 */
@Component
public class WxSubUserDetailRepository extends BaseRepository<WxSubUserDetail> {

    @Resource
    WxSubUserDetailMapper wxSubUserDetailMapper;

    /**
     * 查询用户关注详情
     *
     * @param appId
     * @param openid
     * @return
     */
    public WxSubUserDetail selectByOpenId(String appId, String openid) {
        Example example = new Example(WxSubUserDetail.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("appId", appId);
        criteria.andEqualTo("openid", openid);
        return wxSubUserDetailMapper.selectOneByExample(example);
    }
}
